home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / chip-cd_2005_05.zip / 05 / Internet / Amaya 9.1 / Amaya 9.1 Win / amaya-WinXP-9.1.exe / amaya / MathML.trans < prev    next >
Text File  |  2005-02-07  |  6KB  |  352 lines

  1. ! file MathML.trans : structure transformation for MathML
  2. ! see HTML.trans for a description of Trans language
  3. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4.  
  5. ! WARNING : transformations do NOT work with Multiscript elements
  6. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  7.  
  8.  
  9. !!! Parenthesis Transformations
  10.  
  11. !surround an element with parentheses
  12. parenthesize:*;
  13.         {
  14.         * > mrow:mo."(";
  15.         * > mrow:*;
  16.         * > mrow:mo.")";
  17.         }
  18.  
  19. !surround a sequence of elements with parentheses
  20. !group: first:*,?*+, last:* ;
  21. !        {
  22. !        first > mrow:mo."(";
  23. !        first > mrow:*;
  24. !        * > mrow:*;
  25. !        last > mrow:*;
  26. !        last > mrow:mo.")";
  27. !        }
  28.  
  29. !remove parenthesis
  30. remove parenthesis: mrow{mf,?*+,mf};
  31.     {
  32.     mf /;
  33.     * > :*;
  34.     }
  35.  
  36. !!! mrow transformations
  37.  
  38. !surround an element with a mrow
  39. surrounding row: *;
  40.         {
  41.         * > mrow:*;
  42.         }
  43.  
  44. !surround a sequence of elements with a mrow
  45. surrounding row: *,*+;
  46.         {
  47.         * > mrow:*;
  48.         }
  49.  
  50. ! remove a mrow level
  51. remove row: mrow{*+};
  52.         {
  53.         * > :*;
  54.         }
  55.  
  56. !!! mstyle transformations
  57.  
  58. !surround an element with a mstyle
  59. surrounding mstyle: *;
  60.         {
  61.         * > mstyle:*;
  62.         }
  63.  
  64. !surround a sequence of elements with a mstyle
  65. surrounding mstyle: *,*+;
  66.         {
  67.         * > mstyle:*;
  68.         }
  69.  
  70. ! remove a mstyle level
  71. remove mstyle: mstyle{*+};
  72.         {
  73.         * > :*;
  74.         }
  75.  
  76. !!! Root Transformations
  77.  
  78. !surround an element with a root
  79. surrounding root : *;
  80.     {
  81.     * > mroot:*;
  82.     * > mroot:none % ;
  83.     }
  84.  
  85. !surround a sequence of elements with a root
  86. surrounding root: *+,last:*;
  87.         {
  88.         * > mroot.mrow:*;
  89.     last > mroot.mrow:*;
  90.     last > mroot:none % ;
  91.         }
  92.  
  93. !remove a root
  94. remove root: mroot{base:*,? index:*};
  95.         {
  96.         base > :*;
  97.     index / ;
  98.         }
  99.  
  100.  
  101. !!! Square Root Transformations
  102.  
  103. !surround an element with a square root
  104. surrounding square root: *;
  105.         {
  106.         * > msqrt:*;
  107.         }
  108.  
  109.  
  110. !surround a sequence of elements with a square root
  111. surrounding square root: *,*+;
  112.         {
  113.         * > msqrt.mrow:*;
  114.         }
  115.  
  116. !remove a square root
  117. remove square root: msqrt{*};
  118.         {
  119.         * > :*;
  120.         }
  121.  
  122. !transform a square root into a root
  123. root with index: msqrt{*};
  124.     {
  125.     * > mroot:*;
  126.     * > mroot:none %;
  127.     }
  128.  
  129. !transform a square root into a menclose
  130. menclose: msqrt{*};
  131.     {
  132.     * > menclose:*;
  133.     }
  134.  
  135. !!! menclose Transformations
  136.  
  137. !surround an element with a menclose
  138. surrounding menclose: *;
  139.         {
  140.         * > menclose:*;
  141.         }
  142.  
  143.  
  144. !surround a sequence of elements with a menclose
  145. surrounding menclose: *,*+;
  146.         {
  147.         * > menclose:*;
  148.         }
  149.  
  150. !remove a menclose
  151. remove menclose: menclose{*};
  152.         {
  153.         * > :*;
  154.         }
  155.  
  156. !transform a menclose into a square root
  157. square root: menclose{*};
  158.     {
  159.     * > msqrt:*;
  160.     }
  161.  
  162. !!! Fraction transformations
  163.  
  164. !transform 2 elements into a fraction
  165. fraction: (num:*,den:*) | mrow{num:*,den:*};
  166.         {
  167.         num > mfrac:*;
  168.         den > mfrac:*;
  169.         }
  170.  
  171. !transform an  element into a numerator
  172. numerator: *;
  173.         {
  174.         * > mfrac:*;
  175.         * > mfrac:none %;
  176.         }
  177.  
  178. !transform an sequence of elements into a numerator
  179. numerator: ?*+,last:*;
  180.         {
  181.         * > mfrac.mrow:*;
  182.     last > mfrac.mrow:*;
  183.         last > mfrac:none %;
  184.         }
  185.  
  186. !transform an element into a denominator
  187. denominator: *;
  188.         {
  189.         * > mfrac:none %;
  190.         * > mfrac:*;
  191.         }
  192.  
  193. !transform an sequence of elements into a denominator
  194. denominator: first:*,?*+;
  195.         {
  196.         first > mfrac:none %;
  197.     first > mfrac.mrow:*;
  198.         * > mfrac.mrow:*;
  199.         }
  200.  
  201. !remove a fraction
  202. remove fraction: mfrac{?(num:*),?(den:*)};
  203.         {
  204.         num > :*;
  205.         den > :*;
  206.         }
  207.  
  208.  
  209. !!! Sub and Sup Transformations
  210.  
  211. !surroud an element with a subsup
  212. add sub and sup:*;
  213.     {
  214.     * > msubsup:*;
  215.     * > msubsup:none%;
  216.     * > msubsup:none;
  217.     }
  218.  
  219. !removes a subsup
  220. remove subsup: msubsup{base:*,?sub:*,?sup:*};
  221.     {
  222.     base > :*;
  223.     sub /;
  224.     sup /;
  225.     }
  226.  
  227. !removes a superscript
  228. remove superscript: msubsup{base:*,?sub:*,?sup:*};
  229.     {
  230.     msubsup > msub;
  231.     sup /;
  232.     }
  233.  
  234. !removes a subscript
  235. remove subscript: msubsup{base:*,?sub:*,?sup:*};
  236.     {
  237.     msubsup > msup;
  238.     sub /;
  239.     }
  240.  
  241. !surroud element with a sub
  242. add subscript:*;
  243.     {
  244.     * > msub:*;
  245.     * > msub:none %;
  246.     }
  247.  
  248. !removes a subscript
  249. remove subscript: msub{base:*,?sub:*};
  250.     {
  251.     base > :*;
  252.     sub /;
  253.     }
  254.  
  255. !surroud an element with a sup
  256. add superscript:*;
  257.     {
  258.     * > msup:*;
  259.     * > msup:none %;
  260.     }
  261.  
  262. !removes a superscript
  263. remove superscript: msup{base:*,?sup:*};
  264.     {
  265.     base > :*;
  266.     sup /;
  267.     }
  268.  
  269. !change msub into msup
  270. superscript:msub;
  271.     {
  272.     msub > msup;
  273.     }
  274.  
  275. !change msup into msub
  276. subscript:msup;
  277.     {
  278.     msup > msub;
  279.     }
  280.  
  281. !change msub or msup into msubsup
  282. subsup:msub{base:*,sub:*} | msup{base:*,sup:*};
  283.     {
  284.     base > msubsup:*;
  285.     sup > msubsup:none %;
  286.     sup > msubsup:*;
  287.     sub > msubsup:*;
  288.     sub > msubsup:none;
  289.     }
  290.  
  291. !change msubsup into munderover
  292. change into munderover: msubsup{base:*,sub:*,sup:*};
  293.   {
  294.   base > munderover:*;
  295.   sub > munderover:*;
  296.   sup > munderover:*;
  297.   }
  298.  
  299. !!! Under and Over transformations
  300.  
  301. !surroud an element with a underover
  302. add under and over:*;
  303.     {
  304.     * > munderover:*;
  305.     * > munderover:none %;
  306.     * > munderover:none;
  307.     }
  308.  
  309. ! remove an underover
  310. remove under and over:munderover{base:*,?under:*,?over:*};
  311.     {
  312.     base > :*;
  313.     under /;
  314.     over /;
  315.     }
  316.  
  317. !surroud an element with a over
  318. add over:*;
  319.     {
  320.     * > mover:*;
  321.     * > mover:none %;
  322.     }
  323.  
  324. ! remove an over
  325. remove under and over:mover{base:*,?over:*};
  326.     {
  327.     base > :*;
  328.     over /;
  329.     }
  330.  
  331. !surroud an element with a under
  332. add under:*;
  333.     {
  334.     * > munder:*;
  335.     * > munder:none;
  336.     }
  337.  
  338. ! remove an under
  339. remove under:munder{base:*,?under:*};
  340.     {
  341.     base > :*;
  342.     under /;
  343.     }
  344.  
  345. !change munderover into msubsup
  346. change into msubsup: munderover{base:*,under:*,over:*};
  347.   {
  348.   base > msubsup:*;
  349.   under > msubsup:*;
  350.   over > msubsup:*;
  351.   }
  352.